package org.orman.mapper;

import org.orman.mapper.annotation.Id;

/**
 * Determines the way how compulsory {@link Id}-annotated fields are threatened
 * before executing queries. They can be auto incremented by DBMS or native
 * generator of framework can be used or it can be manually set.
 * 
 * @author alp
 */
public enum IdGenerationPolicy {
	/**
	 * Provides a way to set id such that developer should update {@link Id}
	 * field manually and makes sure that there is NO collision on @Id field.
	 */
	MANUAL,

	/**
	 * Provides a way to set id such that both ORM framework and developer does
	 * not worry about the {@link Id} field and ORM will defer Id generation to
	 * the DBMS (can be AUTO INCREMENT etc.)
	 * 
	 * It is not guaranteed that id generated by DBMS is attached to the
	 * instance after insert command.
	 * 
	 * By this option, {@link Id} field will not appear in created object-query
	 * SQL statements.
	 */
	DEFER_TO_DBMS,

	/**
	 * Experimental genarator with NO GUARANTEE of collision. Provides values
	 * for {@link String}, {@link Long} and {@link Integer} fields using system
	 * time seed and hash code of the entire entity instance. Attaches generated
	 * id to the instance after generation.
	 */
	ORMAN_ID_GENERATOR, ;
}
